package com.geovis.emergency.spd.entity.basic.pojo.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.geovis.emergency.spd.entity.basic.entity.BasicDutyOrg;
import com.geovis.emergency.spd.entity.system.pojo.node.INode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  基础模块-组织架构VO
 * </p>
 *
 * @author Lonsho
 * @version 1.0
 * @date 2022/7/11
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "BasicDutyOrgVO对象", description = "基础模块-组织架构VO")
public class BasicDutyOrgVO extends BasicDutyOrg  implements INode<BasicDutyOrgVO> {
    @ApiModelProperty(value = "角色集合（多天以,分隔）")
    private String roleNames;

    @ApiModelProperty(value = "子集列表")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<BasicDutyOrgVO> children;

    /**
     * 是否有子孙节点
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Boolean hasChildren;
    @Override
    public List<BasicDutyOrgVO> getChildren() {
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        return this.children;
    }

}
